home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / programs / write / rexx / oberonerror.wrx < prev   
Text File  |  1996-09-18  |  3KB  |  152 lines

  1. /*
  2.  * REXX-SCRIPT für WRITE 5.0
  3.  * Dies Script unterstützt den Umgang mit dem
  4.  * Amiga Oberon Compiler 3.0 von A+L.
  5.  * Dieses Script mit den Parametern FIRST, CURRENT, PREV, NEXT oder LIST aus
  6.  * dem aktuellen Text heraus starten.
  7.  *
  8.  *
  9.  *  $VER: oberonerror.wrx 1.2 (27-5-96)
  10.  *
  11.  *  History:
  12.  *
  13.  *  1.2 Addepted to WRITE 5.0
  14.  *  1.1 fixed bug with filenames ending in uppercase forms of ".mod"
  15.  *      transformed " !" to "!" [TT]
  16.  *  1.0 initial Version
  17.  *
  18.  */
  19.  
  20. IF ~show('P',"WRITE")
  21. THEN DO
  22.  say 'Dieses Script läuft nur, wenn WRITE bereits gestartet wurde!'
  23.  exit 10
  24. END
  25.  
  26. ADDRESS "WRITE"
  27.  
  28. OPTIONS RESULTS
  29.  
  30. /*** Argumentkontrolle ***/
  31.  
  32. arg what
  33. if (what ~= "FIRST") & (what ~= "NEXT") & (what ~= "CURRENT") & (what ~= "PREV") & (what~="LIST") then do
  34.   'MessageOk("Fehler:\nDieses Script muß mit FIRST, CURRENT, PREV oder LIST\nals Argument aufgerufen werden !")'
  35.   exit
  36. end
  37.  
  38. /*** Open oberonsupport.library ***/
  39.  
  40. libname = "oberonsupport.library"
  41.  
  42. if ~show("L", libname) then do
  43.   if ~addlib(libname, 0, -30, 1) then do
  44.     text = "Fehler :\n'" || libname "'\nkonnte nicht gefunden werden"
  45.     'MessageOk(&text)'
  46.   end
  47. end
  48.  
  49. /*** Filenamen holen ***/
  50.  
  51. '&filename:=_fileName' /* Kompletten Filenamen (mit Pfad) holen */
  52.  
  53. suffix = right(filename,4)
  54. upper suffix
  55. if suffix ~= ".MOD" then do
  56.   "Message(`Fehler:\n'` | FilePart(_fileName)| `'\nist kein Oberon Sourcecode!`)"
  57.   exit
  58. end
  59.  
  60. filename = filename || 'E'
  61.  
  62. /*** Enthält Fehler ? ***/
  63.  
  64. count = GETERRCOUNT(filename)
  65. if count < 0 then do
  66.   "MessageOk(`'` | FilePart(_fileName) | `'\nenthält keine Fehler`)"
  67.   exit
  68. end
  69.  
  70. cnt = getclip("CurrentError")
  71.  
  72. if cnt = "" then do
  73.   cnt = 0
  74. end
  75.  
  76. if what = "LIST" then do
  77.   ShowErrorList()
  78. end
  79. if what = "FIRST" then do
  80.   cnt = 0
  81. end;
  82. if what = "NEXT" then do
  83.   cnt = cnt+1
  84. end;
  85. if what = "PREV" then do
  86.   cnt = cnt-1
  87. end
  88.  
  89. if cnt >= count then do
  90.   "Message(`'` | FilePart(_fileName) | `'\nenthält keine Fehler`)"
  91.   exit
  92. end
  93.  
  94. if cnt < 0 then do
  95.   'MessageOk("Erster Fehler\nbereits erreicht!")'
  96.   exit
  97. end
  98.  
  99. if ~GETERROR(filename, cnt, Error.) then do
  100.   'MessageOk("Fehler:\nKann Fehlerdatei nicht laden!")'
  101.   exit
  102. end
  103.  
  104. 'Goto([NUMBER(&Error.column),NUMBER(&Error.line)])'
  105.  
  106. text = "Fehler Nr." cnt+1 "von" count || ":\n" || "`" || GETERRORTEXT(Error.num) || "'"
  107.  
  108. 'MessageOk(&text)'
  109.  
  110. if ~setclip("CurrentError",cnt) then do
  111.   'MessageOk("Fehler:\nKann mir aktuellen Fehler nicht merken!")'
  112. end
  113.  
  114. exit 0
  115.  
  116. ShowErrorList:
  117.  
  118. 'ClearList(0)'
  119.  
  120. do x = 0 to count-1
  121.   if GETERROR(filename, x, Error.) then do
  122.     text = x+1 || " " || "`" || GETERRORTEXT(Error.num) || "'"
  123.     'AddList(&text,0)'
  124.   end
  125. end
  126.  
  127. '&result:=ShowList(0,&cnt,&text){@SELECT}'
  128.  
  129. if result then do
  130.   if Text~="" then do
  131.     Error = Word(Text,1)
  132.     cnt = Value(Error) - 1
  133.  
  134.     if ~GETERROR(filename, cnt, Error.) then do
  135.       'MessageOk("Fehler:\nKann Fehlerdatei nicht laden!")'
  136.       exit
  137.     end
  138.  
  139.     'Goto([&Error.column,&Error.line])'
  140.  
  141.     text = "Fehler Nr." cnt+1 "von" count || ":\n" || "`" || GETERRORTEXT(Error.num) || "'"
  142.  
  143.     'MessageOk(&text)'
  144.  
  145.     if ~setclip("CurrentError",cnt) then do
  146.       'MessageOk("Fehler:\nKann mir aktuellen Fehler nicht merken!")'
  147.     end
  148.   end
  149. end
  150.  
  151. exit 0
  152.